/*------------------------------------------------------------------------------------------------------------------------------------*/
/* jquery.newsticker.pack.js */
/*
*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(1($){$.9.D=$.9.g=1(b){b=b||p;i=1(a){j(a);a.4=$("r",a);a.4.q(":o(0)").l().C();a.5=0;h(a)};h=1(a){a.m=t(1(){f(a)},b)};j=1(a){s(a.m)};8=1(a){a.3=7};d=1(a){a.3=c};f=1(a){e(a.3)6;a.3=7;$(a.4[a.5]).n("k",1(){$(2).l();a.5=++a.5%(a.4.B());$(a.4[a.5]).z("k",1(){a.3=c})})};2.y(1(){e(2.x.w()!="A")6;i(2)}).v("g").u(1(){8(2)},1(){d(2)});6 2}})(E);',41,41,'|function|this|pause|items|currentitem|return|true|pauseTicker|fn|||false|resumeTicker|if|doTick|ticker|startTicker|initTicker|stopTicker|slow|hide|tickfn|fadeOut|eq|4000|not|li|clearInterval|setInterval|hover|addClass|toLowerCase|nodeName|each|fadeIn|ul|size|end|newsTicker|jQuery'.split('|'),0,{}))
/*------------------------------------------------------------------------------------------------------------------------------------*/
/*
*/
;(function(jQuery)
{
    var NTicker=function(options, obj)
    {
        var attributes=
        {
            position: 0,
            originalChildrenNum: obj.children().length,
            originalChildrenWidth: 0,
            childrenNum: 0,
            childrenWidth: 0,
            tickerTimeoutHandle: null,
            tickerFunction: function() {},
            isHoverStop: false
        };
        attributes.childrenNum=2*attributes.originalChildrenNum;
        
        var newClonedChildren = obj.children().clone();

        obj.append( newClonedChildren );

        obj.children().each( function(ix)
        {
            attributes.childrenWidth += jQuery(this).outerWidth();
        }
        );

        attributes.originalChildrenWidth = attributes.childrenWidth / 2;

        obj.css( 'width' , attributes.childrenWidth);

        var domObj=obj.get(0);

        function startTickerHoriz()
        {
            if(options.speed < 0 )
                {

                if(attributes.position <= 0)
                    {
                    obj.prepend( obj.children().slice(-attributes.originalChildrenNum) );
                    attributes.position = attributes.originalChildrenWidth;
                }
                attributes.position += options.speed;
                domObj.style.left = (-1*attributes.position) + 'px';
            }
            else if(options.speed > 0 )
                {

                if( attributes.position >= attributes.originalChildrenWidth)
                    {
                    obj.append( obj.children().slice(0, attributes.originalChildrenNum) );
                    attributes.position = 0;
                }
                attributes.position += options.speed;
                domObj.style.left = (-1*attributes.position) + 'px';
            }
            attributes.tickerTimeoutHandle = setTimeout( attributes.tickerFunction, options.interval );
        }

        attributes.tickerFunction=startTickerHoriz;
        function hoverStop()
        {
            if( attributes.tickerTimeoutHandle )
                {
                attributes.isHoverStop=true;
                clearTimeout( attributes.tickerTimeoutHandle );
                attributes.tickerTimeoutHandle=null;
            }
        };
        function hoverStart()
        {
            if(attributes.isHoverStop && !attributes.tickerTimeoutHandle)
                {
                attributes.isHoverStop=false;
                attributes.tickerFunction();
            }
        };

        if(options.stopOnHover)
            {
            obj.hover(hoverStop, hoverStart);
        }
        
        attributes.tickerFunction();
        
        this.setSpeed=function(speed)
        {
            options.speed=speed;
            return obj;
        };
        this.stop=function()
        {
            if( attributes.tickerTimeoutHandle )
                {
                clearTimeout( attributes.tickerTimeoutHandle );
                attributes.tickerTimeoutHandle=null;
            }
        };
        this.start=function()
        {
            if(!attributes.tickerTimeoutHandle)
                {
                attributes.tickerFunction();
            }
        };
        this.increaseSpeed=function()
        {
            options.speed++;
        };
        this.decreaseSpeed=function()
        {
            options.speed--;
        };
        this.toggleDirection=function()
        {
            options.speed*=-1;
        };
        this.getSpeed=function()
        {
            return options.speed;
        };
    };
    jQuery.fn.nTicker=function(opt, arg1, arg2)
    {
        return this.each(
        function()
        {
            var obj = jQuery(this);
            var options=jQuery.extend( {}, jQuery.fn.nTicker.defaults, opt );
            
            var data=obj.data('nTicker_object');
            if (!data)
                {
                obj.data('nTicker_object', new NTicker(options, obj));
            }
            else if(typeof(data[opt])=='function')
                {
                data[opt](arg1, arg2);
            }
        }
        );
    };
    jQuery.fn.nTicker.defaults =
    {
        speed: 1,
        interval: 30,
        stopOnHover: true
    };
})(jQuery); 

